#页面类：登录页

from selenium.webdriver.common.by import By


from utils.page_base import PageBase

class PageLogin(PageBase):
    pathUrl="/simple/login"
    loc_zanhao=By.NAME,"login_info"
    loc_pwd=By.NAME,"password"
    loc_loginButton=By.CSS_SELECTOR,"input.input_submit[value='登录']"
    loc_errorTip=By.CSS_SELECTOR,"div.prompt"


    def __init__(self,driver,base_url):
        PageBase.__init__(self,driver,base_url)


    #输入某账号
    def input_zanhao(self,zanhao):
        self.input(PageLogin.loc_zanhao,zanhao)

    #输入某密码
    def input_pwd(self,pwd):
        self.input(PageLogin.loc_pwd,pwd)

    #点击“登录”按钮
    def click_loginButton(self):
        self.click(PageLogin.loc_loginButton)

    #获取错误提示div标签的文本内容
    def getErrorTipDivText(self):
        return self.getEleText(PageLogin.loc_errorTip)

    #获取账号框的class属性的值
    def getZanhaoClassAttr(self):
        return self.getEleAttr(PageLogin.loc_zanhao,"class")

    #获取密码框的class属性的值
    def getPwdClassAttr(self):
        return self.getEleAttr(PageLogin.loc_pwd,"class")
